home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / Documentation / Engineering Notes / Save As (Cyberdog) < prev    next >
Encoding:
Text File  |  1996-09-18  |  2.1 KB  |  60 lines  |  [TEXT/ttxt]

  1. OpenDoc
  2. Development
  3. Framework
  4.                                                                                                                                                                                     
  5. Save As (CyberDog)
  6. ODF Release  2                                                                                                                                                           
  7.  
  8. What it is for:
  9.  
  10. ODF contains utilities routines for implementing "Save As…" dialog functionality. You will need to use them when writing a Cyberdog-savvy part, or for any other situtions where you can export multiple kinds of data.
  11.  
  12. What it does:
  13.  
  14. The FW_AskSaveAs function will present a save dialog with an additional menu control (to choose the saved format).
  15.  
  16. How to use it:
  17.  
  18. • Create an FW_SaveAsInfo resource. It will look like this:
  19.  
  20. resource FW_SaveAsInfo (1000) 
  21. {
  22.        "Save a copy as:",
  23.        {
  24.              "as OpenDoc™ Document",
  25.              "as Internet Reference",
  26.              "as Picture"
  27.        }
  28. };
  29.  
  30. • Add menu handling to your part by overriding FW_CPart::DoMenu, and adding the following code to your override:
  31.  
  32. if (id == kODCommandSaveACopy) 
  33. {
  34.       FW_PFileSpecification whatFile(ev, "");
  35.       
  36.    short whatKind;
  37.       FW_Boolean doIt = ::FW_AskSaveAs(this, 1000, "myPicture", whatFile, whatKind);
  38.       if (doIt)
  39.    {
  40.       // add your file saving code here
  41.    }
  42. }
  43.  
  44. When FW_AskSaveAs returns, the values of the parameters you passed will be as follows:
  45.  
  46.    - whatFile will be set to the destination file that the user selected.
  47.    - whatKind will be set to the value of the menu control. It defaults to 1.
  48.  
  49. The function result of FW_AskSaveAs will be false if the user chose Cancel, otherwise it will be true.
  50.  
  51. • Add FWSaveAs.rsrc to your project (it is in :ODF:Internet:).
  52.  
  53. Note: the code is in the ODFInternet project, so you will have to build and link against ODFInternet.lib. 
  54.  
  55. Examples:
  56.  
  57. Use of the Save As utility is demonstrated in ODFBitmap.
  58.  
  59. © 1993 - 1996 Apple Computer, Inc. All rights reserved.
  60. Apple, the Apple Logo, Macintosh, and OpenDoc are trademarks of Apple Computer, Inc., registered in the United States and other countries.